package com.example.mybatispuls.blog.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.mybatispuls.blog.entity.Excel;
import com.example.mybatispuls.blog.mapper.ExcelMapper;
import com.example.mybatispuls.blog.service.ExcelService;
import com.example.mybatispuls.company.entity.Company;
import com.example.mybatispuls.company.service.CompanyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author 开发者
 * @since 2022-05-12
 */
@Service
@DS("master")
public class ExcelServiceImpl extends ServiceImpl<ExcelMapper, Excel> implements ExcelService {

    @Autowired
    private CompanyService companyService;
    @Autowired
    private ExcelMapper excelMapper;

    @Override
    public Map<String, Object> queryExcel() {
        Map<String, Object> map = new HashMap<>();
        List<Excel> excels = excelMapper.selectList(null);
        List<Company> companies = companyService.queryCompany();
        map.put("excels", excels);
        map.put("companies", companies);
        return map;
    }

}
